import Cache from '@/util/cache'
const state = {
	userInfo:Cache.get("USER") || null,
	token: Cache.get("TOKEN") || null,
}

const mutations = {
	login(state, str) {
	    state.token = str;
	    Cache.set("TOKEN", str);
	},
	setUserInfo(state, user) {
		 state.userInfo = user;
		 Cache.set("USER", user);
	},
	logout(state) {
	    // state.token = undefined;
	    Cache.remove('TOKEN');
		Cache.remove('USER');
	}
};

const actions = {
     
};

export default {
    state,
    mutations,
    actions
};
